﻿using System.Collections.Generic;
using System.Data;
using ControleRepresentante.Data.CatalogSteps;

namespace ControleRepresentante.Data.Catalogs
{
    public class ControleRepresentanteCatalog : ICatalog
    {
        private readonly ControleRepresentanteCatalogInternal m_ControleRepresentanteCatalogInternal;

        public ControleRepresentanteCatalog()
        {
            m_ControleRepresentanteCatalogInternal = new ControleRepresentanteCatalogInternal();
        }
        public string Name
        {
            get { return m_ControleRepresentanteCatalogInternal.Name; }
        }

        public void Initialize(IDbConnection connection, bool checkCatalog)
        {
            m_ControleRepresentanteCatalogInternal.Initialize(connection, checkCatalog);
        }
    }

    public class ControleRepresentanteCatalogInternal : ICatalog<ControleRepresentanteCatalogStepTypes>
    {
        public void Initialize(IDbConnection connection, bool checkCatalog)
        {
            new DataAccess<ControleRepresentanteCatalogStepTypes>(connection, this, checkCatalog);
        }

        public IEnumerable<ICatalogStep> GetSteps()
        {
            yield return new CreateRepresentanteCatalogStep();
            yield return new CreateSystemUserCatalogStep();
            yield return new CreateAttributeHolderTableCatalogStep();
            yield return new CreateAttributeCatalogStep();
            yield return new CreateDetailsHolderTableCatalogStep();
            yield return new CreateUsuariosHolderTableCatalogStep();
            yield return new CreateContatoTableCatalogStep();
            yield return new CreateEnderecoTableCatalogStep();
            yield return new CreateContaTableCatalogStep();
            yield return new CreateVendedorCatalogStep();
            yield return new CreateTransportadoraCatalogStep();
            yield return new CreateFabricaCatalogStep();
            yield return new CreateClienteCatalogStep();
            yield return new CreatePedidoCatalogStep();
            yield return new CreatePermissaoCatalogStep();
            yield return new CreateSystemUserFiltrosCatalogStep();
            yield return new CreatePostTableCatalogStep();
            yield return new CreateIndexColumnsPreferenceCatalogStep();
            yield return new AddClienteDesdeColumnCatalogStep();
            yield return new CreateRelatorioVisitaCatalogStep();
            yield return new CreateRelatorioVisitaJolitexCatalogStep();
            yield return new UsuarioHolderManyToManySystemUser();
            yield return new AddColumnIdToBuiltInIndexColumnPreference();
            yield return new ChangeCodigoJolitexToString();
            yield return new AddVendedorPedidoAttribute();
            yield return new PedidoNumeroAsAutoIncrement();
            yield return new TriviumSupport();
            yield return new PedidoCreationAndModifiedDates();
        }

        public string Name { get { return "ControleRepresentante"; } }
    }
}